package com.hilinos.base.api.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hilinos.common.common.ReturnCode;
import com.hilinos.common.entity.IBaseVo;
import com.hilinos.common.util.AssertUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel("用户创建、修改、查询")
public class UserVo implements IBaseVo {

    @ApiModelProperty("用户id")
    @TableId("user_id")
    private String userId;
    @ApiModelProperty("平台ID")
    @TableId("appid")
    private String appid;
    @ApiModelProperty("显示名称")
    @TableField("user_display_name")
    private String userDisplayName;
    @ApiModelProperty("手机号")
    @TableField("user_mobile")
    private String userMobile;
    @ApiModelProperty("用户类型;管理员、普通用户等")
    @TableField("user_type")
    private String userType;
    @ApiModelProperty("所属机构ID")
    @TableField("org_id")
    private String orgId;
    @ApiModelProperty("所属部门ID")
    @TableField("dept_id")
    private String deptId;

    @Override
    @JsonIgnore
    public void checkParams() {
        AssertUtils.isNotEmpty(userId, ReturnCode.NORMAL_PARAM_LOST_ERROR.respMsg("用户id不能为空"));
    }

    @JsonIgnore
    public void checkCreateParams() {
        AssertUtils.isNotEmpty(appid, ReturnCode.NORMAL_PARAM_LOST_ERROR.respMsg("appid不能为空"));
        AssertUtils.isNotEmpty(userId, ReturnCode.NORMAL_PARAM_LOST_ERROR.respMsg("用户id不能为空"));
        AssertUtils.isNotEmpty(userType, ReturnCode.NORMAL_PARAM_LOST_ERROR.respMsg("用户类型不能为空"));
        AssertUtils.isNotEmpty(orgId, ReturnCode.NORMAL_PARAM_LOST_ERROR.respMsg("机构ID不能为空"));
        AssertUtils.isNotEmpty(deptId, ReturnCode.NORMAL_PARAM_LOST_ERROR.respMsg("部门ID不能为空"));
    }
}
